package com.lyb.springbootredisclient.api;

import com.lyb.springbootredisclient.app.TestRedisService;
import com.lyb.springbootredisclient.app.sattagy.StrategyService;
import com.lyb.springbootredisclient.entity.User;
//import org.example.LybService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.io.IOException;

/**
 * @author: lyb  2022/7/2 23:02
 */
@RestController
@RequestMapping("test/redis")
public class TestRedisController {

    @Resource
    private TestRedisService testRedisService;

    @Resource
    private StrategyService strategyService;


//    @Resource
//    private LybService lybService;

//    @GetMapping("/getName")
//    public String getName(){
//
//        String name = lybService.getName();
//        return name;
//    };

    @GetMapping("/user/{processCategory}")
    public String userList(@PathVariable String processCategory){

        testRedisService.userList(processCategory);
        return "欢迎来带我的世界";
    };

    @PostMapping
    public User userSyncRedis(@RequestBody User user) throws IOException {
        return testRedisService.userSyncRedis(user);
    };

    @PostMapping("/insertMost")
    public void insertManyData(@RequestBody User user){
         testRedisService.insertManyData(user);
    };


    @PostMapping("/{pay}")
    public String test(@PathVariable("pay") String way){
       return strategyService.payStrategy(way);
    };
}
